<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="./js/vue@3.5.13.js"></script>
</head>

<body>
  <div id="app">
    <button @click="count--">count--</button>
    <div>{{ count }}</div>
    <button @click="count++">count++</button>
  </div>
  <script>
    const { createApp, ref, onBeforeMount, onMounted, onBeforeUpdate, onUpdated, onBeforeUnmount } = Vue
    createApp({
      setup() {
        let count = ref(100)
        onBeforeMount(() => {
          console.log("在挂载之前");
        })
        onMounted(() => {
          console.log("在挂载之后");
        })
        onBeforeUpdate(() => {
          console.log("在数据更新之前");
        })
        onUpdated(() => {
          console.log("在数据更新之后");
        })
        onBeforeUnmount(() => {
          console.log("在页面销毁之前");
        })
        return { count }
      }
    }).mount("#app")
  </script>
</body>

</html>